#include <iostream> 
#include <cstdlib>
#include <cstdio>
//using namespace std;
const char* GetUser()
{
    const char* ret = getenv("USER");
    return ret == NULL ? "error?" : ret;
}
const char* GetHost()
{
    const char* ret = getenv("HOSTNAME");
    return ret == NULL ? "error?" : ret;
}
const char* GetPwd()
{
    const char* ret = getenv("PWD");
    return ret == NULL ? "error?" : ret;
}

void CommandPrompt()
{
    printf("%s@%s:%s$",GetUser(),GetHost(),GetPwd());
}
const char*  CommandGet()
{
    #define MaxInput 256
    char arr[MaxInput];
    fgets(arr,MaxInput,stdin);
    if(arr == NULL)
    {
        arr[0] = '\0';
    }
    return arr;
}

void ParceCommand()
{
    std::string str = CommandGet();
    for(auto au : str)
    {
        std::cout<<str<<std::endl;
    }
}
int main()
{
    //1,输出命令行提示符
    CommandPrompt();
    //2，获取用户输入
    CommandGet();
    //3.处理用户输入
    ParceCommand();
    return 0; 
}
